from common.connect import connect
from common.yamlUtil import YamlUtil
from page.cancel_ota import CancelOta
from page.kill_ota import KillOta
from page.upgrade import Upgrade
from airtest.core.api import *

if __name__ == '__main__':
    conf = YamlUtil("config.yaml").read_yaml()
    connect()
    stop_app(f"{conf['app']}")
    print("测试开始...")
    start_app(f"{conf['app']}")
    # 正常升降级
    ota = Upgrade()
    ota.ota_updown_grade()
    """----------------------------------------------------------------"""
    # 取消升级
    # ota = CancelOta()
    # ota.ota_cancel()
    """----------------------------------------------------------------"""
    # 中断升级
    # ota = KillOta()
    # ota.ota_kill_app()
    sleep(5)
    stop_app(f"{conf['app']}")
    print("测试结束...")
